import { exportTaskTemplateDemo } from "@/api/system/taskTemplate";
import { treeselect, treeselectAndChild } from "@/api/system/taskTemplate";
const systemMixin = {
    data() {},
    created() {},
    methods: {
        // 下载模板文件
        handleExportTemplate() {
            let path = this.$route.path
            let query = path.substr(path.lastIndexOf('/') + 1);
            exportTaskTemplateDemo(query).then(res => {
                var url = res.data.url;
                let aPos = url.lastIndexOf('.');
                let bPos = url.lastIndexOf('/');
                var str = url.substr(bPos + 1, aPos - bPos - 1);
                var a = document.createElement("a");
                a.href = process.env.VUE_APP_BASE_API + url;
                a.download = str + '.xlsx';
                a.click();
            })
        }
    }
}
//新增业务类别树 list
const treeSelectList = {
    data() {},
    created() {

    },
    methods: {
        getTreeSelectChild(page) {
            treeselectAndChild(page).then(response => {
                this.deptOptionsChild = JSON.parse(JSON.stringify(response.data).replace(/isDisabled/g, "checkbox"))
            });
        },
        /** 查询部门下拉树结构 */
        getTreeselect(page) {
            treeselect(page).then(response => {
                this.deptOptions = JSON.parse(JSON.stringify(response.data).replace(/isDisabled/g, "checkbox"))
            });
        },
    }
}
export { systemMixin, treeSelectList }